package com.javabasic.algorithm.leetcode;

import java.util.Scanner;

/**
 * @Author xiongmin
 * @ClassName 津津的储蓄计划
 * @Description TODO
 * @Date 2019/8/31 13:20
 * @Version 1.0
 **/
public class 津津的储蓄计划 {
    static Scanner cin = new Scanner(System.in);

    static int[] arr = new int[12];
    public static void main(String[] args) {

        for (int i = 0; i < 12; i++) {
            arr[i] = cin.nextInt();
        }
        int handMonye = 300;
        int handMom = 0;
        if (handMonye < arr[0]) {
            System.out.println(-1);
            return;
        } else {
            handMonye -= arr[0];
            if (handMonye >= 100) {
                handMom += handMonye/100*100;
                handMonye = handMonye - handMonye/100*100;
            }
        }
        boolean flag = true;
        for (int i = 1; i < 12; i++) {
            handMonye += 300;
            if (arr[i] > handMonye) {
                System.out.println(-(i + 1));
                flag = false;
                break;
            } else {
                handMonye -= arr[i];
                if (handMonye >= 100) {
                    handMom += handMonye/100*100;
                    handMonye = handMonye - handMonye/100*100;
                }
            }

        }
        if (flag) {
//            System.out.println(handMom);
            int result = (int) (handMom * 1.2) + handMonye;
            System.out.println(result);
        }

    }
}
